<!-- 功能区域 -->
<template>
  <div class="fun-container">
    <div class="main">
      <div class="item" v-for="(item,index) in dataArr" :key="index" @click="Jump(item.path,item.isOcclusion)">
        <Box :colorArr=item.colorArr :isOcclusion="item.isOcclusion">
            <div class="icon" :style="{background:`linear-gradient(0deg, ${item.colorArr[0]},${item.colorArr[1]})`}">
              <Icon :type="item.iconType"></Icon>
            </div>
            <p class="text">{{ item.text }}</p>
        </Box>
      </div>
    </div>
  </div>
</template>
    
<script setup>
import Icon from "@/components/Icon/index.vue";
import Box from "@/components/Box/index.vue";
import {useRouter} from "vue-router"
import {useUserStore} from "@/store/useUserStore.js"
import { storeToRefs } from "pinia";
const router = useRouter()
const store = useUserStore()
const {readUserInfo} = storeToRefs(store)
const dataArr = [
  {
    colorArr:['#ffaf96', '#ff8195'],
    iconType:"SignIn",
    text: "签到",
    path:"signin",
    isOcclusion: !readUserInfo.value.checkInTime ? true : false
  },
  {
    colorArr:["#d8a5c5", "#f6ead5"],
    iconType:"CheckIn",
    text: "入住",
    path:"checkin",
    isOcclusion: !readUserInfo.value.checkInTime ? false : true
  },
  {
    colorArr:["#f7e0a2", "#d7f8f0"],
    iconType:"record",
    text: "签到记录",
    path:"record",
    isOcclusion: !readUserInfo.value.checkInTime ? true : false
  },
  {
    colorArr:["#9ea4df", "#ade4d3"],
    iconType:"info",
    text: "宿舍信息",
    path:"info",
    isOcclusion: !readUserInfo.value.checkInTime ? true : false
  },
  {
    colorArr:["#de90d7", "#f2b9a7"],
    iconType:"RepairReport",
    text: "报修",
    path:"RepairReport",
    isOcclusion: !readUserInfo.value.checkInTime ? true : false
  }
]
// 跳转
function Jump(path,isOcclusion){
  
  if(!isOcclusion){
    router.push({
      name:path
    })
  }
}

</script>

  <style lang="less" scoped>
@import "@/styles/var.less";
.fun-container {
  width: 100%;
  height: 100%;
  .main {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .box-container {
      width: 150px;
      height: 200px;
    }
    .icon {
      width: 100px;
      height: 100px;
      line-height: 100px;
      border-radius: 50%;
      margin: 20px auto;
      text-shadow: 2px 2px 10px #3b3b3b;
      
    }
    .text{
      font-size: 20px;
        font-weight: bold;
    }
  }
}

.icon-container {
  color: #fff;
  font-size: 50px;
}
</style>